<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="activeName">
          <el-tab-pane label="登录账户设置" name="account">
            <LoginSetting :user-info="userInfo"></LoginSetting>
          </el-tab-pane>
          <el-tab-pane label="个人详情" name="detail">
            <UserInfo :user-info="userInfo"></UserInfo>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
// 导入员工详情子组件(正常放一起,此处为了练习)
import LoginSetting from './components/login-setting.vue'
import UserInfo from './components/user-info.vue'
import { getUserDetailById } from '@/api/user'
export default {
  components: {
    LoginSetting,
    UserInfo
  },
  data () {
    return {
      userInfo: {},
      // 当前选中的页签
      activeName: 'detail'
    }
  },
  created () {
    this.getUserInfo()
  },
  methods: {
    async getUserInfo () {
      const userInfo = await getUserDetailById(this.$route.params.id)
      // console.log(userInfo)
      this.userInfo = userInfo
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
